Import Libraries
# importing all the necessary libraries
library(tsibble)
##
## Attaching package: 'tsibble'
## The following objects are masked from 'package:base':
##
## intersect, setdiff, union
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5 ✓ purrr 0.3.4
## ✓ tibble 3.1.6 ✓ dplyr 1.0.7
## ✓ tidyr 1.1.4 ✓ stringr 1.4.0
## ✓ readr 2.1.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
Import dataset
# CREATE THE DATAFRAME
data <- read_csv('Covid_Age.csv')
## Rows: 46 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): Cases, Age
## date (1): Week
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
data <- data_frame(data)
## Warning: `data_frame()` was deprecated in tibble 1.1.0.
## Please use `tibble()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
head(data)
## # A tibble: 6 × 3
## Week Cases Age
## <date> <dbl> <dbl>
## 1 2021-01-03 7 88
## 2 2021-01-10 6 83
## 3 2021-01-17 6 83
## 4 2021-01-24 5 90
## 5 2021-01-31 5 85
## 6 2021-02-07 5 80
Check for Null Values
#CHECK FOR NULL VALUES IN THE DF
is.null(data)
## [1] FALSE
#Number of Cases each week
fig <- plot_ly(data, x = ~Week, y = ~Cases, type = 'scatter', mode='lines+markers')
fig
#Age v/s Number of cases
fig_1 <- plot_ly(data, x = ~Age, y = ~Cases, type = 'bar')
fig_1
Conclusion
- There was a peek in the number of cases by the mid of May 2021
- People with age more than 75 were more affected than other age groups.